package com.ruoyi.classai.api;

import cn.hutool.core.date.DateUtil;
import com.ruoyi.common.core.context.ThirdSessionHolder;
import com.ruoyi.classai.service.IEwcChapterService;
import com.ruoyi.classai.service.IEwcClassService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 首页接口
 * @author lcj
 * @date 2025年03月02日 11:56
 */
@Slf4j
@Validated
@RestController
@Tag(name = "首页接口", description = "教师端首页接口")
@RequestMapping("/api/home")
public class HomeApi {

    @Autowired
    private IEwcClassService classService;

    @Autowired
    private IEwcChapterService chapterService;

    /**
     * 查询今日课表信息
     * @return 课表信息
     */
    @Operation(summary = "查询今日课表信息")
    @GetMapping("/getTodayCourse")
    public AjaxResult getTodayCourse(){

        return AjaxResult.success("success",chapterService.getTodayCourseChapter(ThirdSessionHolder.getThirdSession().getId(), DateUtil.format(DateUtil.date(),"yyyy-MM-dd")));
    }

    /**
     * 查询我的班级
     * @return 课表信息
     */
    @Operation(summary = "查询我的班级")
    @GetMapping("/getMyClass")
    public AjaxResult getMyClass(){
        //查询今日
        return AjaxResult.success("查询成功",classService.getClassList(null,null));
    }
}
